gdk: Make gdk_keyval_name() return a const char
authorBenjamin Otte <otte@redhat.com>
Mon, 20 Aug 2018 04:20:05 +0000 (06:20 +0200)
committerMatthias Clasen <mclasen@redhat.com>
Sun, 9 Feb 2020 21:50:22 +0000 (16:50 -0500)
The string is const, so return it like that.

gdk/gdkkeys.c
gdk/gdkkeys.h
gtk/a11y/gtkaccessibilityutil.c
gtk/gtkaccellabel.c
gtk/gtkshortcutlabel.c

index 3425c3b3f1277e3184ddcf645eeab6fc9546be68..a60a33be3e74cdeaffd0a469475a43e4e6a1c63e 100644 (file)
@@ -738,7 +738,7 @@ gdk_keymap_get_modifier_mask (GdkKeymap         *keymap,
  *     of the key, or %NULL if @keyval is not a valid key. The string
  *     should not be modified.
  */
-gchar *
+const gchar *
 gdk_keyval_name (guint keyval)
 {
   return _gdk_keyval_name (keyval);
index 1c9093e807f4f352f00c6d02198f6adf3d8d69f4..5189bc54c7fd05e2d92852eb9540ba3e6974cfec 100644 (file)
@@ -133,7 +133,7 @@ GdkModifierType gdk_keymap_get_modifier_mask       (GdkKeymap           *keymap,
 /* Key values
  */
 GDK_AVAILABLE_IN_ALL
-gchar*   gdk_keyval_name         (guint        keyval) G_GNUC_CONST;
+const char *gdk_keyval_name      (guint        keyval) G_GNUC_CONST;
 
 GDK_AVAILABLE_IN_ALL
 guint    gdk_keyval_from_name    (const gchar *keyval_name);
index 1b840f80e1829fa3bc6ac00834d898c211444db4..beaae3a50e0b5dd2824559e7b9921054bd655be3 100644 (file)
@@ -131,7 +131,7 @@ atk_key_event_from_gdk_event_key (GdkEventKey       *key,
 
   event->state = state;
   event->keyval = keyval;
-  event->string = gdk_keyval_name (keyval);
+  event->string = (char *) gdk_keyval_name (keyval);
   event->length = strlen (event->string);
   event->keycode = keycode;
   event->timestamp = gdk_event_get_time ((GdkEvent *)key);
index 65c8b4b7f55857eb469684ac3e9ec7fa500e1dfc..75ee16bc8cb39827be8b0fa983d544c50b5cede9 100644 (file)
@@ -574,10 +574,10 @@ find_accel (GtkAccelKey *key,
  * so no need to be UTF-8 safe.
  */
 static void
-append_without_underscores (GString *s,
-                            gchar   *str)
+append_without_underscores (GString    *s,
+                            const char *str)
 {
-  gchar *p;
+  const char *p;
 
   if (g_str_has_prefix (str, "XF86"))
     p = str + 4;
@@ -816,7 +816,7 @@ _gtk_accel_label_class_get_accelerator_label (GtkAccelLabelClass *klass,
     }
   else if (!append_keyval_symbol (accelerator_key, gstring))
     {
-      gchar *tmp;
+      const char *tmp;
 
       tmp = gdk_keyval_name (gdk_keyval_to_lower (accelerator_key));
       if (tmp != NULL)
index 55ca247589cf123627b631b9ac545bfdba51f6eb..be430d88dd12e02d732dc69ad30b99732e85932c 100644 (file)
@@ -130,7 +130,7 @@ get_labels (guint key, GdkModifierType modifier, guint *n_mods)
   const gchar *labels[16];
   GList *freeme = NULL;
   gchar key_label[6];
-  gchar *tmp;
+  const gchar *tmp;
   gunichar ch;
   gint i = 0;
   gchar **retval;